# encoding: utf-8
"""
!/usr/bin/python3
@Author: Gao Shuo
@Time: 2019/4/4 14:48 
@ReadMe:
    Input: 
    Output: 
"""
from mesa.time import RandomActivation
# The below is needed for both notebooks and scripts
import matplotlib.pyplot as plt
from test_model import *
from mesa.space import MultiGrid
import numpy as np
from mesa.batchrunner import BatchRunner
import pandas as pd

# 准备好的起始数据
path_input = r'C:\Users\THINKPAD\Desktop\数据组\项目\1902多智能体模型\输入.csv'
data_input = pd.read_csv(path_input, header=0)
print(data_input)

# datacollector 画图
model = YanglaoModel(50, 10, 10)
for i in range(100):
    model.step()
satisfactory = model.datacollector.get_model_vars_dataframe()
satisfactory.plot()
plt.show()

agent_satisfactory = model.datacollector.get_agent_vars_dataframe()
print(agent_satisfactory.head())

# end_wealth = agent_wealth.xs(5, level="Step")["Wealth"]
# end_wealth.hist(bins=range(agent_wealth.Wealth.max()+1))
#
# one_agent_wealth = agent_wealth.xs(14, level="AgentID")
# one_agent_wealth.Wealth.plot()
# plt.show()




